package com.smallpineapple.turing.service.guest.impl;

import com.smallpineapple.turing.dao.TeacherDao;
import com.smallpineapple.turing.entity.Teacher;
import com.smallpineapple.turing.service.guest.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Jack
 * @date 2019-10-29-22:02
 */
@Service
public class TeacherServiceImpl implements TeacherService {
    @Autowired
    private TeacherDao teacherDao;

    @Override
    public List<Teacher> findAllTeachers() {
        return teacherDao.findAll();
    }

    @Override
    public Teacher findTeacherById(Long id) {
        Teacher teacher = teacherDao.findById(id).get();
        System.out.println(teacher.getRole().getRoleName());
        return teacher;
    }
}
